{literal}<style>
    span.dev_tools_item{
        color:#2f2f2f;
        display:inline-block;
        min-height:24px;
        border-right:1px solid #ccc;
        padding:7px 10px 3px 2px;
    }
    span.dev_tools_item i{
        letter-spacing:2px;
		cursor:pointer;
		background-image: url();
		background-position:3px 50%;
		padding:2px 0 2px 25px;
		background-repeat:no-repeat;
    }
	
	span.dev_tools_item i.request{
		background-image: url();
	}
	
	span.dev_tools_item i.elements{
		background-image: url();
	}
	
	span.dev_tools_item i.database{
		background-image: url();
	}
	
	span.dev_tools_item i.page{
		background-image: url();
	}
	
    span.dev_tools_item i.events{
		background-image: url();
	}
    
    
    .ow_prf_item{
        font:13px Arial;
        font-weight: normal;
        padding:12px;
    }
    
    .ow_prf_item h3{
        font: bold 20px Arial;
        color:#313131;
        padding: 20px 0;
    }
    
    table.ow_dev_tools{
        width: 100%;
    }
    
    table.ow_dev_tools td, table.ow_dev_tools th{
        padding: 8px 10px;
        border: 1px solid #e1c9a6;
    }
    table.ow_dev_tools th{
        background: #ede7df;
    }
    
    div.ow_dev_tools_info{
        font: 14px Arial;
        font-style: italic;
        padding: 5px 0;
    }
    
    div.ow_dtools_clb{
        font-size: 14px;
        color: blue;
        padding-bottom: 6px;
    }
    
</style>
<script>
OWshowDevToolTab = function( id ){
	$('.ow_prf_item').hide();
	$('#'+id).show();
	$('#ow_dev_tools_screen').show();
}
OWhideDevToolScreen = function(){
	$('#ow_dev_tools_screen').hide();
}
OWremoveDevTools = function(){
    $('#ow_dev_tools_bar').remove();
    $('#ow_dev_tools_screen').remove();
}
OWcacheClear = function(){
    
}
</script>
{/literal}
<div id="ow_dev_tools_bar" style="position: fixed;background-color: #f7f7f7;bottom: 0;left:0;margin:0;padding: 0;z-index: 6000000;width: 100%;border-top: 1px solid #bbb;font: 11px Verdana, Arial, sans-serif;text-align: left;color: #2f2f2f;">
    <span class="dev_tools_item">
        <i onclick="OWshowDevToolTab('ow_dev_tools_info');">Oxwall:</i> <b>{$oxwall.version}</b> ({$oxwall.build})
    </span>
    <span class="dev_tools_item">
        <i onclick="OWshowDevToolTab('ow_dev_tools_profiler');" class="page">Page:</i> <b>{$profiler.total|string_format:'%.3f'}</b>s | <b> {$memoryUsage}</b>MB
    </span>
    <span class="dev_tools_item">
        <i onclick="OWshowDevToolTab('ow_dev_tools_request');" class="request">Request:</i> <b>{$requestHandler.controller}</b>::<b>{$requestHandler.action}</b>
    </span>
    <span class="dev_tools_item">
        <i onclick="OWshowDevToolTab('ow_dev_tools_elements');" class="elements">Components:</i> <b>{$renderedItems.count}</b>
    </span>
    <span class="dev_tools_item">
        <i onclick="OWshowDevToolTab('ow_dev_tools_events');" class="events">Events:</i> <b>{$events.callsCount}</b>
    </span>
    <span class="dev_tools_item">
        <i onclick="OWshowDevToolTab('ow_dev_tools_database');" class="database">Database:</i> <b>{$database.qc}</b>qrs | <b> {$database.qet|string_format:'%.3f'}</b>s
    </span>
    <span style="display:block; position:absolute; top:7px; right:10px; width:14px; height:14px; cursor: pointer;font-size: 14px;color: red;" onclick="OWremoveDevTools()"><b>x<b></span>
    {if !empty($clrBtnUrl)}<span style="display:block; position:absolute; top:10px; right:40px; cursor: pointer;font-size: 10px;color: green;" onclick="if(confirm('Are you sure you want to clear smarty and themes cache?')) window.location = '{$clrBtnUrl}';"><b>CLEAR CACHE<b></span>{/if}
</div>

<div id="ow_dev_tools_screen" style="position:fixed; width:80%;left:10%;height:80%;top:8%;background:#fff;z-index:1000000;border:5px solid #aaa;display:none;">
    <div style="padding-right:10px;padding-top:2px;">
    <div style="padding:7px;float:left;">Developer tools</div>
    <a href="javascript://" style="float:right;text-decoration:none;color:red;font-size:14px;" onclick="OWhideDevToolScreen();">x</a>
    <div style="clear:both"></div>
    </div>
    
    <div style="height: 95%; width: 100%;overflow: scroll;">
    
    <div id="ow_dev_tools_profiler" class="ow_prf_item" style="display: none;">
        <div class="ow_dev_tools_info">Total page generation time: <b>{$profiler.total}</b> seconds</div>
        <div class="ow_dev_tools_info">Memory usage: <b>{$memoryUsage}</b> MB</div>
        
        <h3>Profiler marks</h3>
        
        <table class="ow_dev_tools">
            <tr>
                <th style="width: 30%;">Mark name</th>
                <th style="width: 50%;">Description</th>
                <th style="width: 20%;">Time</th>
            </tr>
            <tr>
                <td>Page start</td>
                <td>Script start.</td>
                <td><b>{$profiler.marks.start}</b></td>
            </tr>
            <tr>
                <td>Before application init</td>
                <td>Registering system data (includes system constants define, adding of standard package pointers, registering base classes, etc).</td>
                <td><b>{$profiler.marks.before_app_init}</b></td>
            </tr>
            <tr>
                <td>After application init</td>
                <td>Application initialization (includes setting application defaults, base managers init, active plugins init, creating default document, registering all static documents, etc). </td>
                <td><b>{$profiler.marks.after_app_init}</b></td>
            </tr>
            <tr>
                <td>After routing</td>
                <td>Routing process (searching controller+action which should handle the request).</td>
                <td><b>{$profiler.marks.after_route}</b></td>
            </tr>
            <tr>
                <td>After controller action call</td>
                <td>Calling controller action (plugin custom logic).</td>
                <td><b>{$profiler.marks.after_controller_call}</b></td>
            </tr>
            <tr>
                <td>After finalize</td>
                <td>Getting final markup from all renderable objects. Compiling document body.</td>
                <td><b>{$profiler.marks.after_finalize}</b></td>
            </tr>
            <tr>
                <td>Page end</td>
                <td>Processing all headers and sending rendered document.</td>
                <td><b>{$profiler.marks.end}</b></td>
            </tr>
        </table>
    </div>
    <div id="ow_dev_tools_database" class="ow_prf_item" style="display: none">
        <div class="ow_dev_tools_info">Total queries count: <b>{$database.qc}</b> </div>
        <div class="ow_dev_tools_info">Total execution time: <b>{$database.qet|string_format:'%.3f'}</b> seconds</div>
        <h3>Query log</h3>
        <table class="ow_dev_tools">
            <tr>
                <th style="width: 70%;">Query</th>
                <th style="width: 20%;">Params</th>
                <th style="width: 10%;">Time</th>
            </tr>
            {foreach from=$database.ql item='query'}
            <tr>
                <td>{$query.query}</td>
                <td>{$query.params}</td>
                <td><b>{$query.execTime|string_format:'%.6f'}</b></td>
            </tr>
            {/foreach}
        </table>
    </div>
    <div id="ow_dev_tools_request" class="ow_prf_item" style="display:none;">
        <div class="ow_dev_tools_info">Controller: <b>{$requestHandler.controller} :: {$requestHandler.action}</b></div>
        <div class="ow_dev_tools_info">Params: <b>{$requestHandler.paramsExp}</b></div>

        
    </div>
    <div id="ow_dev_tools_elements" class="ow_prf_item" style="display:none">
        <div class="ow_dev_tools_info">Components count: <b>{$renderedItems.count}</b> </div>
       <h3>Rendered elements</h3>
		<table class="ow_dev_tools">
            <tr>
                <th style="width: 15%;">Type</th>
                <th style="width: 15%;">Class</th>
                <th style="width: 70%;">Path (class, template)</th>
            </tr>
            {if !empty($renderedItems.items.mp)}
            <tr>
                <td>Master Page</td>
                <td>{$renderedItems.items.mp.class}</td>
                <td>{$renderedItems.items.mp.src}<br />{$renderedItems.items.mp.tpl}</td>
            </tr>
            {/if}
            {if !empty($renderedItems.items.ctrl)}
            <tr>
                <td>Controller</td>
                <td>{$renderedItems.items.ctrl.class}</td>
                <td>{$renderedItems.items.ctrl.src}<br />{$renderedItems.items.ctrl.tpl}</td>
            </tr>
            {/if}
            {foreach from=$renderedItems.items.cmp item='cmp'}
            <tr>
                <td>Component</td>
                <td>{$cmp.class}</td>
                <td>{$cmp.src}<br />{$cmp.tpl}</td>
            </tr>
            {/foreach}
        </table>
        
    </div>
    <div id="ow_dev_tools_info" class="ow_prf_item" style="display:none">
        <div class="ow_dev_tools_info">Soft version: <b>{$oxwall.version}</b></div>
        <div class="ow_dev_tools_info">Soft build: <b>{$oxwall.build}</b></div>
    </div>
    <div id="ow_dev_tools_events" class="ow_prf_item" style="display:none">
        <div class="ow_dev_tools_info">Binded events: <b>{$events.bindsCount}</b></div>
        <div class="ow_dev_tools_info">Called events: <b>{$events.callsCount}</b></div>
        <h3>Called events</h3>
		<table class="ow_dev_tools">
            <tr>
                <th style="width: 30%;">Event</th>
                <th style="width: 50%;">Listener</th>
                <th style="width: 20%;">Params</th>
            </tr>
            {foreach from=$events.call item='event'}
            <tr>
                <td>
                    <b>{$event.name}</b><br /><br />
                    Type: <span style="color:red;">{$event.type}</span><br />
                    Called at: <span style="color:red;">{$event.start}</span><br />
                    Exec time: <span style="color:red;">{$event.exec}</span>
                </td>
                <td>
                    {foreach from=$event.listeners item='listener'}
                    <div class="ow_dtools_clb">{$listener}()</div>
                    {foreachelse}
                    No listeners
                    {/foreach}
                </td>
                <td>
                    {$event.params}
                </td>
            </tr>
            {/foreach}
        </table>
        <h3>Binded events</h3>
		<table class="ow_dev_tools">
            <tr>
                <th style="width: 40%;">Event</th>
                <th style="width: 60%;">Listener</th>
            </tr>
            {foreach from=$events.bind item='event'}
            <tr>
                <td><b>{$event.name}</b></td>
                <td>
                    {foreach from=$event.listeners item='listener'}
                    <div class="ow_dtools_clb">{$listener}()</div>
                    {/foreach}
                </td>
            </tr>
            {/foreach}
        </table>
    </div>    
    </div>
</div>
